#! /bin/bash

CURRENTPATH=$(pwd)

cd ..
PJ_ROOT_DIR=$(pwd)

cd ${CURRENTPATH}

PREFIXPATH="/customer/sos"
CROSSCOMPILE="arm-linux-gnueabihf"
CROSS_CC="arm-linux-gnueabihf-gcc"
TOOLCHAINFILE="${CURRENTPATH}/cross-arm-linux-gnueabihf.cmake"
BUILDPATH="${CURRENTPATH}/build"
# -----------------------------------------------------


# 修改.sh脚本权限
chmod 777 *.sh
cd ${SCRIPTDIR}
chmod 777 *

cd ${CURRENTPATH}
if [ ! -x "${BUILDPATH}" ]; 
then
mkdir "${BUILDPATH}"
fi
cd ${BUILDPATH}
rm -rf *

cmake .. -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAINFILE} -DCMAKE_INSTALL_PREFIX:PATH=${PREFIXPATH} -DRUN_LIB_PATH=${PREFIXPATH} -DPJ_ROOT_DIR=${PJ_ROOT_DIR}
make clean
make -j4


echo "finished buildapp.sh"

